package com.cloud.basic.test;


import com.cloud.basic.Utils.StringUtils;
import org.checkerframework.checker.regex.qual.Regex;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @program: Basic
 * @description: 测试for循环
 * @author: Cloud
 * @create: 2020/9/4 14:44:53
 */
public class testFor {

    public static void main(String[] args) {
//        String[] strings = new String[10];
//        long startTime = System.nanoTime();
//        for (int i = 0; i < strings.length; ) {
//            i++;
////            System.nanoTime()-startTime = 182200
//        }
////        System.nanoTime()-startTime = 109100
//        for (int i = 0; i < 10; ) {
//            i++;
//        }
//        // System.nanoTime()-startTime = 15700
//        System.out.println("System.nanoTime()-startTime = " + (System.nanoTime() - startTime));

        String str = "1.55[1],2.44[2]";
        String[] split = str.split(",");
        System.out.println("split[0].length() = " + split[0].length());
        for (int i = 0; i < split.length; i++) {
            int length = split[i].length();
            split[i] = split[i].substring(0,length-3);
        }
        str = StringUtils.join(split,",");
        System.out.println("str = " + str);
    }
}
